package com.me.study.jdk8.methodReferences;

import org.junit.Test;

/**
 * 通过类名引用静态方法: <p>
 *      Integer::compare
 *
 * @author ME
 * @date 2020/9/17
 */
public class TestStaticMethod {

    /**
     * <pre>静态方法引用: 引用 Integer.parseInt(str)</pre><p>
     *
     * 无需关系访问修饰符, 见: {@link com.me.study.concurrent.thread.ThreadExecutionOrder#threadWait()}
     *
     * @see com.me.study.concurrent.thread.ThreadExecutionOrder#threadWait()
     */
    @Test
    public void testStaticReference() {
        String2Int string2Int = Integer::parseInt;
        System.out.println(string2Int.toInt("199"));

        System.out.println((String2Int) Integer::parseInt);
    }

    @FunctionalInterface
    public interface String2Int {
        int toInt(String str);
    }

}
